package com.briup.srms.sms.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.briup.srms.sms.bean.DormitoryTypePhoto;
import com.briup.srms.sms.dao.DormitoryTypePhotoMapper;
import com.briup.srms.sms.service.IDormitoryTypePhotoService;
import com.jacky.base.utils.CustomerException;

@Service
public class DormitoryTypePhotoServiceImpl implements IDormitoryTypePhotoService {

	@Autowired
	private DormitoryTypePhotoMapper photoMapper;
	
	@Override
	public void saveOrUpdate(DormitoryTypePhoto photo) throws CustomerException {
		if(photo.getId() == null) {
			photoMapper.insert(photo);
		} else {
			photoMapper.updateByPrimaryKey(photo);
		}
		
	}

	@Override
	public void deleteById(long id) throws CustomerException {
		DormitoryTypePhoto photo = photoMapper.selectByPrimaryKey(id);
		if(photo == null) {
			throw new CustomerException("要删除的信息不存在");
		}
		photoMapper.deleteByPrimaryKey(id);
	}

}
